﻿using Activity.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Configuration;

namespace Activity.Comm
{
    public class CheckUserData
    {
        /// <summary>
        /// 结束时间
        /// </summary>
        static readonly DateTime endDate = new DateTime(2016, 11, 27, 23, 59, 59);

        /// <summary>
        /// 开始时间
        /// </summary>
        /// 
        static readonly DateTime beginDate = new DateTime(2016, 11, 24, 0, 0, 0);
        /// <summary>
        /// 测试标识
        /// </summary>
        /// 
        public static readonly string isDebug =WebConfigurationManager.AppSettings["isDebug"];
        /// <summary>
        /// 用户是否注册返回对象
        /// </summary>
        public class ResultData
        {
            public bool isRegister { get; set; }
            public int Count { get; set; }
        }


        public static int UserPlayCount(string openID)
        {
            var dc = new ActivityEntities();
            var query = dc.HD_V_PosList.Where(t => t.openid == openID);
            if (isDebug.ToLower() == "false")
            {
                query = query.Where(t => t.billdate >= beginDate && t.billdate <= endDate);
            }
            return query.Count();
        }
    }

    public class AddressData
    {
        public string openId { get; set; }
        public int pId { get; set; }
        public string UserName { get; set; }
        public string Mobile { get; set; }
        public string Address { get; set; }
    }
    public enum ReslutType
    {
        /// <summary>
        /// 未中奖
        /// </summary>
        NoWinning = 0,
        /// <summary>
        /// 已中奖
        /// </summary>
        Winning = 1,
        /// <summary>
        /// 未注册
        /// </summary>
        NoRegist = 2,
        /// <summary>
        /// 未抽奖
        /// </summary>
        NoLottery = 3,
        /// <summary>
        /// 抽中奖品
        /// </summary>
        Product = 4,
        /// <summary>
        /// 抽奖还没开始
        /// </summary>
        NoStart = 5,
        /// <summary>
        /// 抽奖已结束
        /// </summary>
        IsStop = 6
    }
}
